package models
const (
	Ok                  = 200 //成功
	BadRequest          = 400 //请求失败
	Unauthorized        = 401 //验证失败
	InternalServerError = 500 //服务器内部错误

	ServerErr = "服务器异常，请联系管理员！"

)

//返回结果结构
//Code  错误码
//Msg   返回信息
//Date  返回数据
type Result struct {
	Code int
	Msg  string
	Data interface{}
}

func  (res *Result)  SuccessResult(data interface{})   {
	res.Code=Ok
	res.Msg="success"
	res.Data=data
}
func  (res *Result) ServerErrResult()  {
	res.Code=BadRequest
	res.Msg=ServerErr
}
func (res *Result) FailResult(msg string) {
	res.Code=BadRequest
	res.Msg=msg
}